package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-05-23 01:31
 */
public class GetLeastNumbers {
    public int[] getLeastNumbers(int[] arr, int k) {
        int[] res = new int[k];
        for (int i = 0; i < k; i++) {
            int max = 0;
            for (int j = 1; j < arr.length; j++) {
                if (arr[j] > arr[j - 1]) {
                    max = j;
                }
            }
            res[i] = arr[max];
            arr[max] = Integer.MAX_VALUE;
        }
        return res;
    }
}
